﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using Albon.Model;
namespace BLL
{
    public class PayMethodBLL
    {

        DAL.PayMethodDAL paymethoddal = new DAL.PayMethodDAL();
        /// <summary>
        /// 添加一种付款方式
        /// </summary>
        public bool alterPayMethod(PayMethod paymethod)
        {
            return paymethoddal.alterPayMethod(paymethod);
        }

        /// <summary>
        /// 删除一条付款方式信息(编程过程中会确保信息的删除不会影响已经存在的数据)
        /// </summary>
        /// <param name="id"></param>
        public bool delPayMethod(int id)
        {
            return paymethoddal.delPayMethod(id);
        }

        /// <summary>
        /// 根据名字获取信息
        /// </summary>
        public DataTable getPayMethod(string methodname)
        {
            return paymethoddal.getPayMethod(methodname);
        }

        /// <summary>
        /// 获取付款方式手续费的百分比
        /// </summary>
        public decimal getPercentage(string methodname)
        {
            DataTable dt = paymethoddal.getPayMethod(methodname);
            return decimal.Parse(dt.Rows[0]["percentage"].ToString());
        }
    }
}
